package com.huawei.esdk.uc.u19.north.rest.app.resource.attendee.convert;

import com.huawei.esdk.uc.domain.model.bean.DelAtteInfo;
import com.huawei.esdk.uc.domain.model.u19.Attendee;
import com.huawei.esdk.uc.u19.north.rest.bean.attendee.AttendeeRequest;
import com.huawei.esdk.uc.u19.north.rest.bean.attendee.DelAtteInfoRest;
import com.huawei.esdk.uc.u19.north.rest.bean.attendee.OperateAttendeeRequest;
import com.huawei.esdk.uc.u19.north.rest.bean.attendee.TransferChairmanRequest;
import com.huawei.esdk.uc.u19.north.rest.bean.attendee.UpdateAttendeeRequest;

public class AttendeeResourceConvert
{
    public Attendee getOperateAttendeeRest2Model(OperateAttendeeRequest request)
    {
        Attendee attendee = new Attendee();
        attendee.setUserId(request.getUserId());
        attendee.setOperate(request.getOperate());
        attendee.setIsRegister(request.getIsRegister());
        attendee.setGwIp(request.getGwIp());
        attendee.setConfRoom(request.getConfRoom());
        attendee.setAttribute(request.getAttribute());
        attendee.setAttendeeNumber(request.getAttendeeNumber());
        return attendee;
    }
    
    public Attendee getModifyAttendeeAuthorityRest2Model(UpdateAttendeeRequest request)
    {
        Attendee attendee = new Attendee();
        attendee.setUserId(request.getUserId());
        attendee.setIsRegister(request.getIsRegister());
        attendee.setGwIp(request.getGwIp());
        attendee.setConfRoom(request.getConfRoom());
        attendee.setAttribute(request.getAttribute());
        attendee.setAttendeeNumber(request.getAttendeeNumber());
        return attendee;
    }
    
    public Attendee getTransferChairmanRest2Model(TransferChairmanRequest request)
    {
        Attendee attendee = new Attendee();
        attendee.setUserId(request.getUserId());
        attendee.setGwIp(request.getGwIp());
        attendee.setConfRoom(request.getConfRoom());
        attendee.setOldChairNumber(request.getOldChairNumber());
        attendee.setNewChairNumber(request.getNewChairNumber());
        return attendee;
    }
    
    public Attendee addAttendeeRest2Model(AttendeeRequest attendeeRequest)
    {
        Attendee attendee = new Attendee();
        attendee.setUserId(attendeeRequest.getUserId());
        attendee.setGwIp(attendeeRequest.getGwIp());
        attendee.setConfRoom(attendeeRequest.getConfRoom());
        attendee.setAttendeeNumber(attendeeRequest.getAttendeeNumber());
        attendee.setAttribute(attendeeRequest.getAttribute());
        
        return attendee;
    }
    
    public Attendee delAttendeeRest2Model(AttendeeRequest attendeeRequest)
    {
        Attendee attendee = new Attendee();
        
        if (!attendeeRequest.getDelAtteInfoRest().isEmpty())
        {
            DelAtteInfo delAtteInfo = null;
            
            for (DelAtteInfoRest delAtteInfoRest : attendeeRequest.getDelAtteInfoRest())
            {
                delAtteInfo = new DelAtteInfo();
                
                delAtteInfo.setAttendeeNumber(delAtteInfoRest.getAttendeeNumber());
                delAtteInfo.setIsRegister(delAtteInfoRest.getIsRegister());
                
                attendee.getDelAtteInfos().add(delAtteInfo);
            }
        }
        
        attendee.setUserId(attendeeRequest.getUserId());
        attendee.setGwIp(attendeeRequest.getGwIp());
        attendee.setConfRoom(attendeeRequest.getConfRoom());
        attendee.setDeleteCount(attendeeRequest.getDeleteCount());
        
        return attendee;
    }
    
}
